﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BIS.Portal.Core.Base;
using BIS.Portal.Core.Global;

namespace BIS.Portal.Modules.CMS
{
    public partial class CmsMediaDetailControl_Settings : ControlSettingBase
    {
        #region Load data setting
        public bool HienThiMediaAnh
        {
            get { return  GetControlSetting<bool>(ModuleSettingNames.CmsMediaDetail.ddlMediaAnh,PortalContext.LanguageAlias); }
        }
        public string SLMediaAnhHienThi
        {
            get { return GetControlSetting<string>(ModuleSettingNames.CmsMediaDetail.txtSLMediaAnh, PortalContext.LanguageAlias); }
        }
        public bool HienThiTenAnh
        {
            get { return GetControlSetting<bool>(ModuleSettingNames.CmsMediaDetail.ddlTenAnh, PortalContext.LanguageAlias); }
        }
        public bool HienThiMediaVideo
        {
            get { return GetControlSetting<bool>(ModuleSettingNames.CmsMediaDetail.ddlMediaVideo, PortalContext.LanguageAlias); }
        }
        public string SLMediaVideoHienThi
        {
            get { return GetControlSetting<string>(ModuleSettingNames.CmsMediaDetail.txtMediaVideo, PortalContext.LanguageAlias); }
        }
        public bool HienThiTenAnhVideo
        {
            get { return GetControlSetting<bool>(ModuleSettingNames.CmsMediaDetail.ddlTenAnhVD, PortalContext.LanguageAlias); }
        }
        public bool HienThiMediaFlash
        {
            get { return GetControlSetting<bool>(ModuleSettingNames.CmsMediaDetail.ddlMediaFlash, PortalContext.LanguageAlias); }
        }
        public string SLMediaFlashHienThi
        {
            get { return GetControlSetting<string>(ModuleSettingNames.CmsMediaDetail.txtMediaFlash, PortalContext.LanguageAlias); }
        }
        public bool HienThiTenAnhFlash
        {
            get { return GetControlSetting<bool>(ModuleSettingNames.CmsMediaDetail.ddlTenAnhFlash, PortalContext.LanguageAlias); }
        }
        #endregion

        protected void Page_Load(object sender, EventArgs e)
        {
            loadsettings();
        }

        private void loadsettings()
        {
            ddlMediaAnh.SelectedIndex = HienThiMediaAnh ? 0 : 1;
            txtSLMediaAnh.Text = SLMediaAnhHienThi;
            ddlTenAnh.SelectedIndex = HienThiTenAnh ? 0 : 1;
            ddlMediaVideo.SelectedIndex = HienThiMediaVideo ? 0 : 1;
            txtMediaVideo.Text = SLMediaVideoHienThi;
            ddlTenAnhVD.SelectedIndex = HienThiTenAnhVideo ? 0 : 1;
            ddlMediaFlash.SelectedIndex = HienThiMediaFlash ? 0 : 1;
            txtMediaFlash.Text = SLMediaFlashHienThi;
            ddlTenAnhFlash.SelectedIndex = HienThiTenAnhFlash ? 0 : 1;
        }

        public override void SaveSettings(Dictionary<string, string> settings)
        {
            SetControlSettingForAllLanguages(ddlMediaAnh.ID, ModuleSettingNames.CmsMediaDetail.ddlMediaAnh, settings);
            SetControlSettingForAllLanguages(txtSLMediaAnh.ID, ModuleSettingNames.CmsMediaDetail.txtSLMediaAnh, settings);
            SetControlSettingForAllLanguages(ddlTenAnh.ID, ModuleSettingNames.CmsMediaDetail.ddlTenAnh, settings);
            SetControlSettingForAllLanguages(ddlMediaVideo.ID, ModuleSettingNames.CmsMediaDetail.ddlMediaVideo, settings);
            SetControlSettingForAllLanguages(txtMediaVideo.ID, ModuleSettingNames.CmsMediaDetail.txtMediaVideo, settings);
            SetControlSettingForAllLanguages(ddlTenAnhVD.ID, ModuleSettingNames.CmsMediaDetail.ddlTenAnhVD, settings);
            SetControlSettingForAllLanguages(ddlMediaFlash.ID, ModuleSettingNames.CmsMediaDetail.ddlMediaFlash, settings);
            SetControlSettingForAllLanguages(txtMediaFlash.ID, ModuleSettingNames.CmsMediaDetail.txtMediaFlash, settings);
            SetControlSettingForAllLanguages(ddlTenAnhFlash.ID, ModuleSettingNames.CmsMediaDetail.ddlTenAnhFlash, settings);
        }
    }
}